package com.moment.model;


import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;





public class GlobalClass {
	static String filename = "abc";



 
 public static String encryptpass(String pass)
 {
	 StringBuffer sb = null;
	 
	 try {
			MessageDigest md = MessageDigest.getInstance("SHA-256");
			md.update(pass.getBytes());

			byte byteData[] = md.digest();

			//convert the byte to hex format method 1
			sb = new StringBuffer();
			for (int i = 0; i < byteData.length; i++) {
			 sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
			}

			System.out.println("Hex format : " + sb.toString());

			
		
		} catch (NoSuchAlgorithmException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
	return sb.toString().substring(2,10);
 }

}
